/*	******************************************
	File:		SoundTracker.h
	Author:		Adnan Srna, Peter Kober, Ivo Havranek
	Purpose:	AugmentedReality 2
	(up)Date:	March/April 2010
	Descr.:		class for sound input
	Origin:		Salzburg University of Applied Science
	******************************************	*/

#pragma once
#include "fft.h"
#include "ofMain.h"

#define BUFFER_SIZE 128
#define NUM_WINDOWS 80

class CSound: public ofSimpleApp{
	public:
		CSound::CSound();
		CSound::~CSound();

		void setup();
		void update();
		void draw();
	
		void	audioReceived(float *input, int bufferSize, int nChannels);
		float	amplitude;

	private:
		float	*left;
		float	*right;
		int 	bufferCounter;
		fft		myfft;
		
		float	magnitude[BUFFER_SIZE];
		float	phase[BUFFER_SIZE];
		float	power[BUFFER_SIZE];
		
		float	freq[NUM_WINDOWS][BUFFER_SIZE/2];
		float	freq_phase[NUM_WINDOWS][BUFFER_SIZE/2];
};
